package goover.unit01;

public class Animal01 {
    public static void main(String[] args){
        Test t1 = new Test();
        t1.shout1();
        t1.shout();
        t1.shout2();
        Test04.getInt();
        shout(new Test01() {
            @Override
            public void shout() {
                System.out.println("匿名内部类！");
            }
        });
        shout(() ->
        {System.out.println("Lambda表达式！");}
        );
        shout1(20, 30, new Test1() {
            @Override
            public int sum(int a, int b) {
                return a * b;
            }
        });
        shout1(2,3,(x,y) -> x+y);
        try {
            divde();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void divde() throws Exception{
        System.out.println(3 / 0);
    }
    public static void shout(Test01 t){
        t.shout();
    }
    public static void shout1(int x,int y, Test1 t){
        System.out.println(t.sum(x,y));
    }
}
interface Test01{
    void shout();
}
interface Test04 extends Test01{
    void shout2();
    static void getInt(){
        System.out.println("接口Test04的静态方法!");
    }
}
abstract class Test02 implements Test04{
    public abstract void shout1();
}
class Test extends Test02 implements Test01,Test04{

    @Override
    public void shout() {
        System.out.println("接口Test01的实现方法！");
    }

    @Override
    public void shout1() {
        System.out.println("抽象类Test02的实现方法！");
    }

    @Override
    public void shout2() {
        System.out.println("接口Test04的实现方法！");
    }
}
interface Test1{
    int sum(int a,int b);
}
